<template>
	<view>
		<u-navbar :autoBack="true"  title="我的客户" 
			safeAreaInsetTop fixed placeholder />
		<u-cell-group>
			<u-cell v-for="(item,index) in list" :key="index" center    size="large"
				:is-link="true" index="index" @click="showDetail(item.id)" :arrow="true"
				:title="item.name"
				:label="item.tel"
				:value="item.gender == '1' ? '男' : '女'"
				center>
			</u-cell>
		</u-cell-group>
			
		<view class="u-padding-30 bg-white" v-if="list.length == 0" >
			<u-empty mode="list" text="暂无客户"></u-empty>
		</view>
	</view>
</template>
<script>
	import paginateMix from "@/mixins/paginateMixins.js"
	import request from '@/utils/request'
	import {showError} from '@/utils/common.js'
	export default {
		mixins: [paginateMix],
		data() {
			return {
				checked: false,
				list: [],
			}
		},
		onLoad() {
			this.handleReq()
		},
		methods: {
			handleReq() {
				request({url:'/erp/student/page4Customer',data:{page: this.pageData.page, self: true}}).then(res => {
					if(!this.$common.handleResponseMsg(res)) return;
					this.list = this.list.concat(res.data.list)
					this.pageData.page = parseInt(res.page);
					this.pageData.lastPage = parseInt(res.pageCount);
				});
			},
			showDetail(id) {
				uni.navigateTo({
					url: `/pages/student/detail?studentId=${id}`
				});
			},
			clickRight() {
				this.list = [];
				this.pageData.page = 1
				this.handleReq()
			},
			clickLeft() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
</style>
